@file:Suppress("unused")

package kotlinx.coroutines.script.tes

import android.graphics.Color
import abc.reflect.App


class ColorDiffer (
    val r: Int, val g: Int, val b: Int,
    val oR: Int = 20,
    val oG: Int = 20,
    val oB: Int = 20,
)
val Int.red get() = this and Color.RED shr 16
val Int.green get() = this and Color.GREEN shr 8
val Int.blue get() = this and Color.BLUE
val Int.rgb get() = ColorDiffer(this.red, this.green, this.blue)
fun Int.rgb(offset: Int) = ColorDiffer(this.red, this.green, this.blue, offset, offset, offset)
fun Int.rgb(offsetRed: Int, offsetGreen: Int, offsetBlue: Int): ColorDiffer {
    return ColorDiffer(this.red, this.green, this.blue, offsetRed, offsetGreen, offsetBlue)
}

fun Set<ColorDiffer>.containsSimilarColor(color: Int): Boolean {
    return any { App.take().isSimilarColor(it.r, it.g, it.b, color.red, color.green, color.blue, it.oR, it.oG, it.oB) }
}
